home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / ip / RDP / rdp_var.h < prev    next >
Encoding:
C/C++ Source or Header  |  1992-06-18  |  5.1 KB  |  152 lines

  1. /**************************************************************************/
  2. /*       Copyright(c) 1987, 1992 by BBN Systems and Technologies,         */
  3. /*         A Division of Bolt Beranek and Newman Inc.                     */
  4. /*                                                                        */
  5. /*       RDP implementation for 4.2/4.3bsd by Craig Partridge             */
  6. /*                                                                        */
  7. /*  Permission to use, copy, modify, distribute, and sell this software   */
  8. /*  and its documentation for any purpose is hereby granted without fee,  */
  9. /*  provided that the above copyright notice and this permission appear   */
  10. /*  in all copies and in supporting documentation, and that the name of   */
  11. /*  Bolt Beranek and Newman Inc.  not be used in advertising or           */
  12. /*  publicity pertaining to distribution of the software without          */
  13. /*  specific, written prior permission. BBN makes no representations      */
  14. /*  about the suitability of this software for any purposes.  It is       */
  15. /*  provided "AS IS" without express or implied warranties.               */
  16. /**************************************************************************/
  17.  
  18. /**************************************************************************/
  19. /*                   rdp internal variables                               */
  20. /**************************************************************************/
  21.  
  22. /*
  23.  * RDP states: RDP_DRAIN is a pseudo-state we hit if user closes with
  24.  * data still to be acked in the outbound queue -- we sit in RDP_DRAIN
  25.  * until the data is acked or timed out.  This because RDP requires that
  26.  * user only close on quiet connection -- and it turns out to be easier
  27.  * for the kernel to do that than the user.
  28.  */
  29.  
  30. #define R_LISTEN      1
  31. #define R_OPEN          2
  32. #define R_CLOSED      3
  33. #define R_SYN_SENT     4
  34. #define R_SYN_RCVD     5
  35. #define R_CLOSE_WAIT    6
  36. #define R_DRAIN        7
  37.  
  38. /*
  39.  * Queue sizes.  If you want to make them larger, consider sticking
  40.  * the input queue in the rdpcb and leaving the output queue in the
  41.  * rdpque structure.
  42.  */
  43.  
  44. #define R_MAXSND    10
  45. #define R_RCVMAX    5
  46. #define R_RCVWIN    (R_RCVMAX * 2)
  47.  
  48. /*
  49.  * timer constants.  See RFC 889 for details on some of them.
  50.  * note that some are wired into rdp_newrtt().
  51.  */
  52.  
  53. #define RT_G        (2)
  54.  
  55.  
  56. #define RT_RTMAX        (120 * 2)     /* max round trip time */
  57. #define RT_RTMIN    (1)         /* 1/2 second min */
  58.  
  59. /*
  60.  * RT_CLOTIME is added to (current retry interval  * max retries)
  61.  * when we go into close wait.
  62.  */
  63.  
  64. #define RT_CLOTIME    (RT_RTMAX * 2)    /* wait a long time */
  65. #define RT_NULLTIME    (RT_RTMAX * 2)    /* send null if idle for twice RTMAX */
  66.  
  67. /*
  68.  * max retries on a particular packet
  69.  */
  70. #define R_MAXTRIES    10
  71.  
  72. /*
  73.  * the protocol control block.  It is full -- there is no more
  74.  * space in the mbuf to add fields.
  75.  */
  76.  
  77. struct rdpcb {
  78.     u_long rp_sndnxt;    /* sn of next segment to be sent */
  79.     u_long rp_snduna;    /* sn of oldest unacked segment */
  80.     u_long rp_sndhsa;    /* highest segment acked */
  81.  
  82.     u_long rp_rcvcur;    /* last seg correct and in order */
  83.     u_long rp_rcvuer;    /* upper edge of rcvwin */
  84.     u_long rp_rcvhi;    /* highest seq received */
  85.  
  86.     /* sun requires us to do floating point by hand and so everyone does */
  87.     struct rdp_rtt {
  88.     u_short rp_rtt;        /* estimated round-trip time */
  89.     u_short rp_rttfrac;    /* fractional bits of rtt estimate */
  90.     } rp_srtt;
  91.  
  92. #define rp_estrtt rp_srtt.rp_rtt
  93.  
  94.     struct rdpque *rp_rq;    /* the queues */
  95.  
  96.     short rp_timer;    /* user/close/syn timer -- counts down */
  97.  
  98.     /* buffer control */
  99.     u_short rp_sndmax;  /* max number of packets in flight */
  100.     u_short rp_sndbuf;    /* max send buffer size -- adjusted for IP/RDP header */
  101.     u_short rp_inflt;    /* number of packets in flight and max in flight */
  102.     u_short rp_maxinflt;
  103.  
  104.     /* quench control values */
  105.     short rp_qwait;    /* how many packets cleared til maxinflt increased? */
  106.  
  107.     u_char rp_state;    /* rdp state */
  108.  
  109.     /* some interesting values to have around */
  110.  
  111.     short rp_lastrtt;    /* most recent rtt */
  112.     short rp_datsegs;    /* # of data segments sent */
  113.     short rp_qcnt;    /* number of quenchs recv'd */
  114. } ;
  115.  
  116. /*
  117.  * RDP sending and receiving queues.
  118.  */
  119.  
  120. struct rdpque {
  121.     struct mbuf *rq_rcvq[R_RCVWIN];    /* rcv queue */
  122.     struct mbuf *rq_sndq[R_MAXSND];    /* send queue */
  123.     short rq_sndtimer[R_MAXSND];    /* send timers -- count up */
  124.     u_char rq_retries[R_MAXSND];    /* retry counters */
  125.     u_char rq_rcvbase;            /* pointer into circular queues */
  126.     u_char rq_sndbase;            /* pointer into circular queues */
  127. };
  128.  
  129.  
  130. struct rdpstats {
  131.     long rst_ipackets;    /* total input packets */
  132.     long rst_opackets;    /* total output packets */
  133.     long rst_nulls;    /* null keepalives sent */
  134.     long rst_fullwin;    /* times we filled a window */
  135.     long rst_hitedge;    /* times we filled our send buffers */
  136.     long rst_retrans;    /* times we had to retransmit */
  137.  
  138.     /* types of dropped packets */
  139.     long rst_cksum;    /* checksum bad */
  140.     long rst_dup;    /* duplicated */
  141.     long rst_range;    /* out of range -- duplicate or window overrun */
  142.     long rst_len;    /* bad length */
  143.  
  144.     /* connections timedout */
  145.     long rst_conntimo;
  146. };
  147.  
  148.  
  149. #ifdef KERNEL
  150. extern struct rdpstats rdp_info;
  151. #endif
  152.